import request from '@/utils/request'

// 获取某专栏下的文章列表
export const getArticleList = (columnId, { currentPage, pageSize }) => {
  return request({
    url: `columns/${columnId}/articles`,
    method: 'get',
    params: {
      currentPage,
      pageSize
    }
  })
}

// 获取文章信息
export const getArticleInfo = (articleId) => {
  return request({
    url: `articles/${articleId}`,
    method: 'get'
  })
}

// 添加文字
export const addArticle = ({ title, excerpt, content, userId, columnId, cover }) => {
  return request({
    url: 'articles',
    method: 'post',
    data: {
      title, excerpt, content, userId, columnId, cover
    }
  })
}
